#ifndef _MODEL_H_
#define _MODEL_H_

#include "GeometryModel.h"

#include <map>
#include <string>

/**
	The higher level concept of a model. A model can have multiple geometry models, so 
	multiple geometry models at different positions can make up a single model.
	
	This will be expanded to denote turrets and other specific things that affect how the overall
	model will be drawn.
*/
class Model {
	/*
		Store pointers to functors for attribute abstraction.	(Turret)
		vector<Attribute Abstraction*> attributeAbstractions;
	*/
	std::map<std::string, GeometryModel> models;		//The model holds the actual instances
	
	//TODO move this into UnitType and BuildingType and such so each instance doesn't save this
	fVec3D backBottomLeft;
	fVec3D frontUpperRight;
	
	//Calculates the above vectors off of all the geometry models
	void calculateRanges();
public:
	Model():	models(), backBottomLeft(), frontUpperRight()		{}
	
	//load from xml file
	void load(const char *filename); 
	
	/*	This draws the model in accordance with how the object thinks it is, then adjust for what attributes it has
		Pass the first two by value because we will be editing values
		The euler angles are the desired rotation in an 'xyz' euler rotation. This is easier for aligning things.
		See Map::getEulerAngles
	*/
	void draw(fVec3D gamePos, fVec3D gameRot, fVec3D eulers, const fVec3D& pointOfInterest);
	
	//Calculates the bounding box when rotated by zRot on the z axis at pos. zRot must be in degrees
	void calculateBoundingBox(const fVec3D& pos, double zRot, fVec2D& A, fVec2D& B, fVec2D& C, fVec2D& D);
};

#endif
